package com.itheima.stream;

import com.itheima.domain.Student;

import java.util.*;
import java.util.stream.Stream;

/*
limit (long l) 限制 只要前几个
skip(long l)  跳过几个
static  concat(Stream a,Stream b)  合并两个流
distinct   去重  可以将流中重复的元素 去除
 */
public class Demo03 {


    public static void main(String[] args) {
        ArrayList<String> list = new ArrayList<>(List.of("鹿晗", "黄子韬", "张艺兴", "张艺兴","吴亦凡","蔡徐坤","易烊千玺","伊藤美诚"));
       //list.stream().limit(5).forEach(s-> System.out.println(s));
       list.stream().skip(3).forEach(s-> System.out.println(s));
        //list.stream().distinct().forEach(s-> System.out.println(s));
        Stream<String> stream = list.stream();
        HashSet<String> set = new HashSet<>(Set.of("王健林", "马云", "马化腾"));
        Stream<String> stream1 = set.stream();

        Stream<String> concat = Stream.concat(stream, stream1);
        //concat.forEach(s -> System.out.println(s));
        long count = concat.count();
        System.out.println(count);

        for (String s : list) {
            System.out.println(s);
        }



    }
}
